﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Reflection;
using System.Configuration;

using Ylh.IDAL;


namespace Ylh.FactoryDAL
{
   public static class DataAccess
    {
       private static readonly string path = ConfigurationManager.AppSettings["DAL"].ToString();

       public static Ylh.IDAL.IStudent GetStr()
       {
           string className = path + ".Student";
           return (Ylh.IDAL.IStudent)Assembly.Load(path).CreateInstance(className);
       }

       /// <summary>
       /// 返回数据库接口
       /// </summary>
       /// <returns></returns>
       public static Ylh.IDAL.ISmDb CreateISmDb()
       {
           string className = path + ".TbSmDbDAL";
           return (Ylh.IDAL.ISmDb)Assembly.Load(path).CreateInstance(className);
       }

       /// <summary>
       /// 返回系统信息接口
       /// </summary>
       /// <returns></returns>
       public static Ylh.IDAL.IPcSystemInfo CreateIsysInfo()
       {
           string className = path + ".PcSystemInfoDAL";
           return (Ylh.IDAL.IPcSystemInfo)Assembly.Load(path).CreateInstance(className);
       }


       /// <summary>
       /// 返回员工信息接口
       /// </summary>
       /// <returns></returns>
       public static Ylh.IDAL.IStaff CreateIStaff()
       {
           string className = path + ".StaffDAL";
           return (Ylh.IDAL.IStaff)Assembly.Load(path).CreateInstance(className);
       }

       /// <summary>
       /// 返回员工详细信息接口
       /// </summary>
       /// <returns></returns>
       public static Ylh.IDAL.IStaffInfo CreateIStaffInfo()
       {
           string className = path + ".StaffInfoDAL";
           return (Ylh.IDAL.IStaffInfo)Assembly.Load(path).CreateInstance(className);
       }

       /// <summary>
       /// 返回角色信息接口
       /// </summary>
       /// <returns></returns>
       public static Ylh.IDAL.IRole CreateIRole()
       {
           string className = path + ".RoleDAL";
           return (Ylh.IDAL.IRole)Assembly.Load(path).CreateInstance(className);
       }


       /// <summary>
       /// 返回权限信息接口
       /// </summary>
       /// <returns></returns>
       public static Ylh.IDAL.ICompetence CreateICompetence()
       {
           string className = path + ".CompetenceDAL";
           return (Ylh.IDAL.ICompetence)Assembly.Load(path).CreateInstance(className);
       }

       /// <summary>
       /// 返回角色关联信息接口
       /// </summary>
       /// <returns></returns>
       public static Ylh.IDAL.IComRole CreateIComRole()
       {
           string className = path + ".ComRoleDAL";
           return (Ylh.IDAL.IComRole)Assembly.Load(path).CreateInstance(className);
       }


       /// <summary>
       /// 返回角色关联信息接口
       /// </summary>
       /// <returns></returns>
       public static Ylh.IDAL.IDepartment CreateIDepartment()
       {
           string className = path + ".DepartmentDAL";
           return (Ylh.IDAL.IDepartment)Assembly.Load(path).CreateInstance(className);
       }

       /// <summary>
       /// 返回客户信息接口
       /// </summary>
       /// <returns></returns>
       public static Ylh.IDAL.ICust CreateICust()
       {
           string className = path + ".CustDAL";
           return (Ylh.IDAL.ICust)Assembly.Load(path).CreateInstance(className);
       }


       /// <summary>
       /// 返回客户跟进信息接口
       /// </summary>
       /// <returns></returns>
       public static Ylh.IDAL.ICustFollow CreateICustFollow()
       {
           string className = path + ".CustFollowDAL";
           return (Ylh.IDAL.ICustFollow)Assembly.Load(path).CreateInstance(className);
       }

       /// <summary>
       /// 返回约见信息接口
       /// </summary>
       /// <returns></returns>
       public static Ylh.IDAL.ICustMetting CreateICustMetting()
       {
           string className = path + ".CustMettingDAL";
           return (Ylh.IDAL.ICustMetting)Assembly.Load(path).CreateInstance(className);
       }


       /// <summary>
       /// 返回约见信息接口
       /// </summary>
       /// <returns></returns>
       public static Ylh.IDAL.ICustServer CreateICustServer()
       {
           string className = path + ".CustServerDAL";
           return (Ylh.IDAL.ICustServer)Assembly.Load(path).CreateInstance(className);
       }

       /// <summary>
       /// 返回约见信息接口
       /// </summary>
       /// <returns></returns>
       public static Ylh.IDAL.INote CreateINote()
       {
           string className = path + ".NoteDAL";
           return (Ylh.IDAL.INote)Assembly.Load(path).CreateInstance(className);
       }

       


    }
}
